feat: add .js extensions for Node.js ESM compatibility#9
Merged
cristinecula merged 1 commit intomasterfrom Feb 7, 2026
Merged
Conversation
Add explicit .js extensions to all local imports to ensure the compiled output works correctly in Node.js ESM environments (e.g., Vitest with moduleResolution: 'bundler'). This follows the TypeScript recommendation for libraries: https://www.typescriptlang.org/docs/handbook/modules/guides/choosing-compiler-options.html#im-writing-a-library Fixes NEO-935
|
🎉 This PR is included in version 2.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
megheaiulian
approved these changes
Feb 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.jsextensions to all local imports in TypeScript source filesmoduleResolution: 'bundler')Problem
When using
@neovici/testingin a Vitest unit test environment (jsdom), the following error occurs:This happens because Node.js ESM requires explicit file extensions in imports, but the compiled TypeScript output was missing them.
Solution
Following the TypeScript recommendation for libraries, we add
.jsextensions to all local imports in the source files. TypeScript preserves these extensions in the output, making the package compatible with both bundlers AND Node.js ESM.Changes
src/index.ts- Added.jsextensions + documentation commentsrc/render-hook.ts- Added.jsextensions to importssrc/renderer.ts- Added.jsextension to importsrc/result.ts- Added.jsextension to importTesting
npm run lintpassesnpm run buildproduces output with.jsextensionsnpm testpasses (14 tests)Fixes NEO-935